<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>后台管理-登陆</title>
    <link rel="stylesheet" href="/ordermaker/pages/layui/css/layui.css">
    <link rel="stylesheet" href="/ordermaker/pages/login/css/admin.css">
</head>
<body>
<div id="container">
    <div></div>
    <div class="admin-login-background">
        <!--<div class="admin-header">-->
        <!--<img src="image/ex_logo.png" class="admin-logo">-->
        <!--</div>-->
        <form class="layui-form" action="">
            <div>
                <i class="layui-icon layui-icon-username admin-icon admin-icon-username"></i>
                <input type="text" name="username" placeholder="请输入用户名"
                       autocomplete="off"
                       class="layui-input admin-input admin-input-username">
            </div>
            <div>
                <i class="layui-icon layui-icon-password admin-icon admin-icon-password"></i>
                <input type="password" name="password"
                       placeholder="请输入密码"
                       autocomplete="off"
                       class="layui-input admin-input admin-input-verify">
            </div>
            <!--<div>-->
                <!--<input type="text" name="verify"-->
                       <!--placeholder="请输入验证码"-->
                       <!--autocomplete="off"-->
                       <!--class="layui-input admin-input admin-input-verify">-->
                <!--<img class="admin-captcha" src=""-->
                     <!--onclick="updateVerify()">-->
            <!--</div>-->
            <button class="layui-btn admin-button" lay-submit lay-filter="formDemo">登陆</button>


        </form>
    </div>
</div>
<script src="/ordermaker/pages/layui/layui.js"></script>
<script>
    layui.use('form', function(){
        var form = layui.form;

        form.on('submit(formDemo)', function(data){
            layer.msg(JSON.stringify(data.field));
            layui.jquery.ajax({
                url: "/ordermaker/admin/sinup",
                type: 'post',//method请求方式，get或者post
                headers: {
                    'Content-Type': 'application/x-www-form-urlencoded'
                },
                xhrFields:{
                    withCredentials:true
                },
                dataType: 'json',//预期服务器返回的数据类型
                data: data.field,//表格数据序列化
                success: function (res) {//res为相应体,function为回调函数
                    if(res.erro!=0){
                        layer.msg('账号或密码错误');
                    }else{
                        location.href="/ordermaker/admin";
                    }
                },
                error: function (res) {
                    console.log(res);
                    layer.msg('系统崩溃请联系开发者！！！');
                }
            });
            return false;
        });
    });
</script>
</body>
</html>